package com.panopset.gui.selection;

import static com.panopset.Util.*;

import java.awt.Color;
import java.awt.FlowLayout;

import javax.swing.JCheckBox;
import javax.swing.JRadioButton;
import javax.swing.JToggleButton;

import com.panopset.gui.container.TitledPanel;

public class SelectionGroup extends TitledPanel {

    private final SelectionPanel o;

    public SelectionGroup(SelectionPanel selectionPanel, String title, String toolTipText, String[][] nvp, boolean isSingleSelectionOnly) {
        super(title, new FlowLayout(), toolTipText);
        this.o = selectionPanel;
        setLayout(new FlowLayout());
        for (String[] s : nvp) {
            JToggleButton btn = isSingleSelectionOnly ? new JRadioButton(s[0]) : new JCheckBox(s[0]);
            btn.setFont(ARIAL_PLAIN_9);
            btn.setBackground(Color.WHITE);
            o.getRadioButtons().add(btn);
            btn.addActionListener(o);
            o.getSelections().put(s[0], s[1]);
            add(btn);
        }
    }

    private static final long serialVersionUID = VERSION_SERIAL_NUMBER;
}
